/**
 * 
 */
package com.example.android_is2.pathDraw;

import java.util.ArrayList;

import com.example.android_is2.InfoGeoPoints;

/**
 * @author KAIN-PC
 * 
 */
// TRASFORMA IL NOME DELLA VIA IN COORDINATE LATITUDINE LONGITUDINE
public class GeoCodingAddr {

  private ArrayList<String> listView = null;
  private ArrayList<InfoGeoPoints> listInfoGeoPoint = null;

  public GeoCodingAddr(ArrayList<String> listView) {
    this.listView = listView;
    listInfoGeoPoint = new ArrayList<InfoGeoPoints>();
  }

  public ArrayList<InfoGeoPoints> TranslateString2GeoPoint() {
    GoogleParser parser;
    String jsonURL = "http://maps.googleapis.com/maps/api/geocode/json?address=";
    for (int i = 0; i < listView.size(); i++) {
      final StringBuffer sBuf = new StringBuffer(jsonURL);
      String pointTxt = listView.get(i).toLowerCase();
      sBuf.append(pointTxt);
      sBuf.append("&sensor=true");
      parser = new GoogleParser(sBuf.toString());
      InfoGeoPoints latlong_con_testo = parser.parseGeoCoding();
      listInfoGeoPoint.add(latlong_con_testo);
    }
    return listInfoGeoPoint;

  }
}
